package com.base.cn.platform.os.service.exam.paper;

import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.exam.ExamBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 试卷关联试题的接口
 *
 * @author s.li
 * @date 2018/12/05
 */
@FeignClient(name = ExamBaseService.appName,configuration = FeignAuthConfig.class)
public interface ExamPaperQuestionService extends ExamBaseService {

    /**
     * 添加试卷的试题数据
     * @param examId 试卷ID
     * @param questionIds 试题ID串
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/saveExamPaperQuestion")
    Map<String,Object> saveExamPaperQuestion(@RequestParam("examId") BigDecimal examId,
                                             @RequestParam("questionIds") String questionIds);

    /**
     * 多条件查询试卷下的试题类型的试题数据列表
     * @param condition 查询条件对象
     * @return List<ExamPaperQuestion>
     */
    @RequestMapping(contextPath + "/findExamPaperQuestionList")
    List<Map<String,Object>> findExamPaperQuestionList(@RequestBody Map<String, Object> condition);

    /**
     * 试卷试题类型模板下的试题的排序
     * @param thisId 原记录ID
     * @param thisSort 新的排序号
     * @param targetId 目标记录ID
     * @param targetSort 新的排序号
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/updateQuestionOrderSort")
    Map<String,Object> updateQuestionOrderSort(@RequestParam("thisId") BigDecimal thisId,
                                               @RequestParam("thisSort") int thisSort,
                                               @RequestParam("targetId") BigDecimal targetId,
                                               @RequestParam("targetSort") int targetSort);

    /**
     * 删除试卷的试题数据
     * @param examId 试卷ID
     * @param ids 数据ID串
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/deleteExamPaperQuestion")
    Map<String,Object> deleteExamPaperQuestion(@RequestParam("examId") BigDecimal examId,
                                               @RequestParam("ids") String ids);

    /**
     * 通过ID,获取试卷下的试题记录
     * @param condition 查询条件
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/findExamPaperQuestionById")
    Map<String,Object> findExamPaperQuestionById(@RequestBody Map<String, Object> condition);

    /**
     * 修改试卷下的试题分数
     * @param examPaperQuestion 数据对象
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/updateExamPaperQuestionScore")
    Map<String,Object> updateExamPaperQuestionScore(@RequestBody Map<String, Object> examPaperQuestion);
}
